package com.zfast.yugioh.junit.observer;

import java.util.Observable;

public class ObservedObject extends Observable {
    private String watchedValue;

    public ObservedObject(String value) {
        watchedValue = value;
    }

    public void setValue(String value) {
        // if value has changed notify observers
        if(!watchedValue.equals(value)) {
            watchedValue = value;

            // mark as value changed
            setChanged();
            notifyObservers(value);//调用监测者
        }

    }
}
